package com.fdhwws.web.domain;

import com.fdh.myjdbcutil.ColumnField;
import com.fdh.myjdbcutil.IMyEntity;

import java.sql.Timestamp;

public class ChatRoomMsg implements IMyEntity {
    @ColumnField(type = ColumnField.Type.SET, isPrimaryKey = true)
    private Integer id;

    @ColumnField
    private Integer userId;

    @ColumnField
    private Integer roomId;

    @ColumnField
    private String username;

    @ColumnField
    private String msg;

    @ColumnField
    private Timestamp sendTime;

    @ColumnField
    private Boolean valid;

    public ChatRoomMsg() {
    }

    public ChatRoomMsg(Integer id, Integer userId, Integer roomId, String username, String msg, Timestamp sendTime, Boolean valid) {
        this.id = id;
        this.userId = userId;
        this.roomId = roomId;
        this.username = username;
        this.msg = msg;
        this.sendTime = sendTime;
        this.valid = valid;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getRoomId() {
        return roomId;
    }

    public void setRoomId(Integer roomId) {
        this.roomId = roomId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Timestamp getSendTime() {
        return sendTime;
    }

    public void setSendTime(Timestamp sendTime) {
        this.sendTime = sendTime;
    }

    public Boolean getValid() {
        return valid;
    }

    public void setValid(Boolean valid) {
        this.valid = valid;
    }

    public ChatRoomMsg safeMode() {
        this.userId = null;
        return this;
    }

    @Override
    public String toString() {
        return "ChatRoomMsg{" +
                "id=" + id +
                ", userId=" + userId +
                ", roomId=" + roomId +
                ", username='" + username + '\'' +
                ", msg='" + msg + '\'' +
                ", sendTime=" + sendTime +
                ", valid=" + valid +
                '}';
    }
}
